// 引入Sequelize模块
const Sequelize = require('sequelize');

// 引入数据库实例
const db = require('../db');

// 定义model
const users = db.define('users', {
    id: { type: Sequelize.BIGINT, primaryKey: true, allowNull: false, autoIncrement: true },
    username: { type: Sequelize.STRING(40), allowNull: false },
    nickname: { type: Sequelize.STRING(20), defaultValue: 'bilibili用户' },
    password: { type: Sequelize.STRING(20), allowNull: false, defaultValue: '123456' },
    avatar: { type: Sequelize.STRING(10000), defaultValue: '//i0.hdslb.com/bfs/face/member/noface.jpg@96w_96h_1c_1s_!web-avatar.avif' },
    follows: { type: Sequelize.INTEGER, defaultValue: 0 },
    fans: { type: Sequelize.INTEGER, defaultValue: 0 },
    introduction: { type: Sequelize.STRING(100), defaultValue: '这个人很懒，还没有个性签名' },
    like: { type: Sequelize.STRING(200) },
    star: { type: Sequelize.STRING(200) },
    coin: { type: Sequelize.STRING(200) },
}, {
    // 是否支持驼峰
    underscored: true,
    // MySQL数据库表名
    tableName: 'users',
});
// 导出model
module.exports = users;